package form;

import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

public class OrderRegistrationForm extends ActionForm {

	private static final Logger logger = Logger.getLogger(OrderRegistrationForm.class);
	private static final String ORDERREGISTRATIONFORM_INFO = "OrderRegistrationForm is error"; 
	
	private static final long serialVersionUID = 1L;

	public OrderRegistrationForm() {
		super();

	}

	private int id_order;	
	private String your_train;
	private String first_name;
	private String last_name;
	private String midle_name;
	private String number;
	
	public ActionErrors validate(ActionMapping mapping,
            HttpServletRequest request) {
 
        ActionErrors actionErrors = new ActionErrors();
        try {
	        if(first_name == null || first_name.trim().equals("")) {
	            actionErrors.add("first_name", new ActionMessage("error.first_name"));
	        }
	        
	        if(last_name == null || last_name.trim().equals("")) {
	            actionErrors.add("last_name", new ActionMessage("error.last_name"));
	        }
        
        }catch(Exception e) {
        	logger.error(OrderRegistrationForm.ORDERREGISTRATIONFORM_INFO + e.getMessage());
        }
        return actionErrors ;
    }
		
	public String getFirst_name() {
		return first_name;
	}

	public void setFirst_name(String first_name) {
		this.first_name = first_name;
	}

	public String getLast_name() {
		return last_name;
	}

	public void setLast_name(String last_name) {
		this.last_name = last_name;
	}

	public String getMidle_name() {
		return midle_name;
	}

	public void setMidle_name(String midle_name) {
		this.midle_name = midle_name;
	}

	public int getId_order() {
		return id_order;
	}

	public void setId_order(int id_order) {
		this.id_order = id_order;
	}

	public String getNumber() {
		return number;
	}

	public void setNumber(String number) {
		this.number = number;
	}
	public String getYour_train() {
		return your_train;
	}

	public void setYour_train(String your_train) {
		this.your_train = your_train;
	}

}
